package com.example.shixunandjavagotoyangchen.BoosYang.Day002;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;

import com.blankj.utilcode.util.ToastUtils;
import com.example.modelviewpresenter.View.BasterFragment;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.BlankFragmentDay00102;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.BlankFragmentDay00103;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.BlankFragmentDay00104;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.BlankFragmentDay00105;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.BlankFragmentDay00106;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.Day00101.MeetDay00101SousuoActivity;
import com.example.shixunandjavagotoyangchen.R;
import com.example.shixunandjavagotoyangchen.Sunshine.FragmentSpaek.FragmentSpaek2;

import java.util.ArrayList;

import q.rorbin.verticaltablayout.VerticalTabLayout;
import q.rorbin.verticaltablayout.widget.TabView;


public class BlankFragmentDay002 extends BasterFragment {


    //HFS
    private ViewPager fenleiViewPager;
    public static VerticalTabLayout viertacltable;
    private TextView fenleiTextView;

    @Override
    public int BandLayout() {
        return R.layout.fragment_blank_fragment_day002;
    }

    @SuppressLint("ResourceType")
    @Override
    public void initView() {


        fenleiViewPager = (ViewPager) findViewById(R.id.fenlei_ViewPager);
        viertacltable = (VerticalTabLayout) findViewById(R.id.viertacltable);
        fenleiViewPager.setNextFocusForwardId(13);
        fenleiTextView = (TextView) findViewById(R.id.fenlei_TextView);
    }

    @Override
    public void initDate() {

        fenleiTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getActivity(), MeetDay00101SousuoActivity.class);
                startActivity(intent);
            }
        });
        //数据
        ArrayList<Fragment> day1fragment = new ArrayList<>();
        ArrayList<String> day1string = new ArrayList<>();
        day1fragment.add(new BlankFragmentDay002_1101());
        day1fragment.add(new BlankFragmentDay002_1102());
        day1fragment.add(new BlankFragmentDay002_1103());
        day1fragment.add(new BlankFragmentDay002_1104());
        day1fragment.add(new BlankFragmentDay002_1105());
        day1fragment.add(new BlankFragmentDay002_1106());
        day1fragment.add(new BlankFragmentDay002_1107());
        day1fragment.add(new BlankFragmentDay002_1108());
        day1fragment.add(new BlankFragmentDay002_1109());
        day1fragment.add(new BlankFragmentDay002_11010());
        day1fragment.add(new BlankFragmentDay002_11011());
        day1fragment.add(new BlankFragmentDay002_11012());
        day1fragment.add(new BlankFragmentDay002_11013());
        day1string.add("男装");
        day1string.add("品牌");
        day1string.add("球鞋");
        day1string.add("女装");
        day1string.add("高街");
        day1string.add("服配");
        day1string.add("包类");
        day1string.add("美妆");
        day1string.add("上海");
        day1string.add("数码");
        day1string.add("潮玩");
        day1string.add("潮童");
        day1string.add("好物");

        FragmentSpaek2 list = new FragmentSpaek2(getActivity().getSupportFragmentManager(), FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT,
                        day1fragment, day1string);

        fenleiViewPager.setAdapter(list);
        viertacltable.setupWithViewPager(fenleiViewPager);



        viertacltable.addOnTabSelectedListener(new VerticalTabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabView tab, int position) {
                Log.i("BlankFragmentDay002", "选中的" + position);
                switch (position) {
                    case 0:
                        BlankFragmentDay002_1101.Day00201SmartRefreshLayout.autoRefresh();
                        break;
                    case 1:
                        BlankFragmentDay002_1102.BrandSmartRefreshLayout.autoRefresh();
                        break;
                    case 2:
                        BlankFragmentDay002_1103.SneakersSmartRefreshLayout.autoRefresh();
                        break;
                    case 3:
                        BlankFragmentDay002_1104.WomenswearSmartRefreshLayout.autoRefresh();
                        break;
                    case 4:
                        BlankFragmentDay002_1105.HighstreetSmartRefreshLayout.autoRefresh();
                        break;
                    case 5:
                        BlankFragmentDay002_1106.ClothingmatchingSmartRefreshLayout.autoRefresh();
                        break;
                    case 6:
                        BlankFragmentDay002_1107.PackageSmartRefreshLayout.autoRefresh();
                        break;
                    case 7:
                        BlankFragmentDay002_1108.BeautymakeupSmartRefreshLayout.autoRefresh();
                        break;
                    case 8:
                        BlankFragmentDay002_1109.LifeSmartRefreshLayout.autoRefresh();
                        break;
                    case 9:
                        BlankFragmentDay002_11010.DigitalSmartRefreshLayout.autoRefresh();
                        break;
                    case 10:
                        BlankFragmentDay002_11011.TideplaySmartRefreshLayout.autoRefresh();
                        break;
                    case 11:
                        BlankFragmentDay002_11012.ChaotongSmartRefreshLayout.autoRefresh();
                        break;
                    case 12:
                        BlankFragmentDay002_11013.GoodthingSmartRefreshLayout.autoRefresh();
                        break;
                }
            }

            @Override
            public void onTabReselected(TabView tab, int position) {
                Log.i("BlankFragmentDay002", "二次点击" + position);
            }
        });

    }


}
